<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Dump {
}

function TextDump(&$Var, $Level=0)
{
  if(is_array($Var)) $Type="Array[".count($Var)."]";
	 else if(is_object($Var)) $Type="Object";
	   else $Type="";
  if(@$Type)
   { echo "$Type\n";
	 for(Reset($Var),$Level++; list($k,$v)=each($Var);)
	 { if(is_array($v) && $k==="GLOBALS") continue;
	   for ($i=0; $i<$Level*3; $i++ ) echo " ";
	   echo "<b>".@HtmlSpecialChars($k),"</b>  =>  ",TextDump($v,$Level);
	 }
   }
	 else echo '"',@HtmlSpecialChars($Var),'"'."\n";
}

Function Dump(&$Var)
{
  if((is_array($Var)||is_object($Var)) && (count($Var)))
	echo "<pre>\n",TextDump($Var),"</pre>\n";
  else
	echo "<tt>",TextDump($Var),"</tt>\n";
}
